home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / computerjanitor / plugins / dpkg_dotfile_plugin.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  2.8 KB  |  65 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import os
  5. import computerjanitor
  6. import computerjanitorapp
  7. _ = computerjanitorapp.setup_gettext()
  8.  
  9. class DpkgDotfilePlugin(computerjanitor.Plugin):
  10.     '''Find .dpkg-old/new files.
  11.     
  12.     This plugin finds .dpkg-old and .dpkg-new files that dpkg creates
  13.     when it handles conffiles. They are typically in /etc, but
  14.     occasionally in some other locations, so we scan a list of directories
  15.     known to have conffiles. Any regular files with a .dpkg-old or
  16.     .dpkg-new suffix is added to the list.
  17.     
  18.     The find-conffiles-dirs script in the source code does this.
  19.     
  20.     '''
  21.     cruft_description = _("File was left on the disk by dpkg as part of its configuration file handling. If your computer works fine, you can remove it. You may want to compare it with the actual configuration file (the one without the .dpkg-old or .dpkg-new suffix). If unsure, don't remove the file.")
  22.     
  23.     def __init__(self):
  24.         self.dirs = [
  25.             '/etc',
  26.             '/var/ax25',
  27.             '/var/cache/roxen4',
  28.             '/var/games',
  29.             '/var/lib/crafty',
  30.             '/var/lib/drac',
  31.             '/var/lib/firebird2',
  32.             '/var/lib/gnats',
  33.             '/var/lib/leksbot',
  34.             '/var/lib/linpopup',
  35.             '/var/lib/lxr-cvs',
  36.             '/var/lib/mason',
  37.             '/var/lib/roxen4',
  38.             '/var/lib/sysnews',
  39.             '/var/list',
  40.             '/var/spool/fcron',
  41.             '/var/spool/hylafax/bin',
  42.             '/var/yp']
  43.  
  44.     
  45.     def scan(self, dirname):
  46.         '''Scan one directory for crufty files.'''
  47.         list = []
  48.         for dirname, dirnames, filenames in os.walk(dirname):
  49.             filenames = _[1]
  50.             filenames = [ os.path.join(dirname, x) for x in filenames ]
  51.             filenames = _[3]
  52.             list += filenames
  53.         
  54.         return list
  55.  
  56.     
  57.     def get_cruft(self):
  58.         list = []
  59.         for dir in self.dirs:
  60.             list += self.scan(dir)
  61.         
  62.         return [ computerjanitor.FileCruft(x, self.cruft_description) for x in list ]
  63.  
  64.  
  65.